package com.fau.cm.action.index;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.fau.cm.action.PublicAction;
import com.fau.cm.entity.MedicalCallStandardArchives;
import com.opensymphony.xwork2.ModelDriven;

/**
 * @desc 健康体检action
 * @author liy
 * @datetime 2014年12月12日,下午3:46:03
 */
@Controller
@Scope("prototype")
@ParentPackage("default")
@Namespace("/")
public class MedicalCallhealthyExaminAction extends PublicAction implements ModelDriven<MedicalCallStandardArchives> {

	private static final long serialVersionUID = -3059047045521497506L;

	private MedicalCallStandardArchives standardArchives = new MedicalCallStandardArchives();
	
	/**
	 * @desc 生成健康报告
	 * @return String
	 * @author liy
	 * @datetime 2014年12月12日,下午4:10:44
	 */
	@Action(value = "call_heath_result")
	public String heathResult(){
		this.list = this.baseAllService.getCallMyManagerService().createHealthResult(standardArchives.getResults());
		HttpServletResponse response = ServletActionContext.getResponse();
		if(null != this.list){
			formatJSON(response, list);
		}
		return null;
	}
	
	/**
	 * @desc 进入查看健康报告页面
	 * @return String
	 * @author liy
	 * @datetime 2014年12月12日,下午7:05:06
	 */
	@Action(value = "call_heath_view", results = {@Result(location = "call_health_result.jsp")})
	public String init(){
		return SUCCESS;
	}
	
	@Override
	public MedicalCallStandardArchives getModel() {
		return standardArchives;
	}

}
